package ge.devfest.hackathon.gg.model;

import java.util.ArrayList;
import java.util.Date;
import java.util.Iterator;
import java.util.List;

import com.j256.ormlite.dao.ForeignCollection;
import com.j256.ormlite.field.DatabaseField;
import com.j256.ormlite.field.ForeignCollectionField;
import com.j256.ormlite.table.DatabaseTable;

@DatabaseTable
public class Activity {

	@DatabaseField(generatedId = true)
	private int id;
	@DatabaseField
	private String title;
	@DatabaseField
	private Status status;
	@DatabaseField
	private double latitude;
	@DatabaseField
	private double longitude;
	@DatabaseField
	private String imageUrl;

	@DatabaseField
	private Date date;
	@DatabaseField
	private String author;
	@DatabaseField
	private String comment;

	@ForeignCollectionField
	private ForeignCollection<Image> images;

	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public Status getStatus() {
		return status;
	}

	public void setStatus(Status status) {
		this.status = status;
	}

	public String getImageUrl() {
		return imageUrl;
	}

	public void setImageUrl(String imageUrl) {
		this.imageUrl = imageUrl;
	}

	public ForeignCollection<Image> getImages() {
		return images;
	}

	public List<Image> getImageList() {
		List<Image> imgList = new ArrayList<Image>();
		if (images != null) {
			Iterator<Image> iterator = images.iterator();
			while (iterator.hasNext()) {
				imgList.add(iterator.next());
			}
		}
		return imgList;
	}

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public double getLatitude() {
		return latitude;
	}

	public void setLatitude(double latitude) {
		this.latitude = latitude;
	}

	public double getLongitude() {
		return longitude;
	}

	public void setLongitude(double longitude) {
		this.longitude = longitude;
	}

	public Date getDate() {
		return date;
	}

	public void setDate(Date date) {
		this.date = date;
	}

	public String getAuthor() {
		return author;
	}

	public void setAuthor(String author) {
		this.author = author;
	}

	public String getComment() {
		return comment;
	}

	public void setComment(String comment) {
		this.comment = comment;
	}

	public static enum Status {
		TO_BE_PLANTED, 
		PLANTED, 
		TO_BE_CLEANED, 
		CLEANED,
		TO_BE_WATERED, 
		WATERED,
		DRAFT
	}

}
